import request from "@/apps/admin/units/request"
import {HttpResultData, HttpResult} from "@/types/project";//导入基本分页数据结构

/**
 * 部门权限
 * @type {{ADD: string, EDIT: string, DEL: string, VIEW: string}}
 */
export const PERMISSIONS: { [key: string]: string } = {
    VIEW: 'admin.department.data',
    ADD: 'admin.department.created',
    EDIT: 'admin.department.updated',
    DEL: 'admin.department.delete'
}

/**
 * 获取后台全部部门
 * @returns {*}
 */
export const getAdministerDepartmentApi = (): Promise<HttpResultData<any>> => request(`/admin-department/data`)

/**
 * 创建部门
 * @type {string}
 */
export const createdDepartmentApi: string = `/admin-department/created`


/**
 * 编辑部门
 * @type {string}
 */
export const updatedDepartmentApi: string = `/admin-department/updated`


/**
 * 删除后台部门
 */
export const removeDepartmentApi = (id: number): Promise<HttpResult> => request(`/admin-department/delete`, {id}, 'POST')